import request from '@/plugins/axios'

/**
 * 合同分页查询
 * @param {Object} query 
 */
export const getContractList = query => {
  return request({
    url: '/api/lessorbill/getBillContractList',
    method: 'get',
    params: query
  })
}

/**
 * 分页查询核算信息列表
 * @param {Obj} query 
 */
export const getAccountList = query => {
  return request({
    url: '/api/lessorbill/page',
    method: 'get',
    params: query
  })
}

//生成账单初始化
export const billInitialization = contractId=>{
    return request({
        url:`/api/lessorbill/generateBillInit/${contractId}`,
        method:'get'
    })
}
//审批记录
export const getApprovalRecord = busId=>{
    return request({
        url:`/api/commonapprovalrecord/${busId}`,
        method:'get'
    })
}
//查看账单
export const viewBill = billId=>{
    return request({
        url:`/api/lessorbill/${billId}`,
        method:'get'
    })
}

 
export const generateBill = (data)=>{
    return request ({
        url:'/api/lessorbill/generateBill',
        method:'post',
        data
    })
}
// 提交
export const  submit = billId =>{
    return request({
        url:`/api/lessorbill/submit`,
        method: 'post',
        params: {billId}
    })
}

//作废
export const abolition = billId=>{
    return request({
        url:`/api/lessorbill/cancel`,
        method:'post',
        params: {billId}

    })
}

/**
 * 获取核算合同所有数据
 * @param {String} contractId 合同id
 */
export const getContractDetails = contractId => {
  return request({
    url: `/api/lessorcontractpayable/checkList/${contractId}`,
    method: 'get'
  })
}